<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="../css/eui.css">
    <style>

        /*全局样式*/
        body {
            margin: 0 auto;
            width: 100%;
            height: 100%;
            max-width: 1920px;
            overflow: hidden;
            background-color: #fff;
            font-family: arial, helvetica, sans-serif;
        }

        * {
            margin: 0;
            padding: 0;
        }

        /*上面一块白条*/
        #head {
            width: 950px;
            height: 100px;
        }

        #middle {
            overflow: hidden;
        }

        /*左右两块div的样式*/
        #leftPart, #rightPart {
            text-align: center;
            margin: 0 auto;
            display: inline;
            width: 50%;
            background-color: #f9f9f9;
            float: left;
        }

        #leftPart > div {
            border-right: 1px solid black;
        }

        #leftPart > div > div {
            margin: 0 auto;
            padding-top: 80px;
            padding-bottom: 40px;
            width: 540px;
        }

        /*标题:Sign In的样式*/
        .title {
            font-size: 40px;
            line-height: 50px;
            font-weight: bold;
            text-align: center;
        }

        /*正文全局样式*/
        .content {
            padding: 0 60px;

        }

        /*输入框相关样式*/
        .text {
            line-height: 30px;
            font-weight: bold;
            text-align: left;
        }

        .item {
            margin: 15px 0;
        }

        .input {
            width: 100%;
            height: 40px;
            line-height: 30px;
            padding: 5px 10px;
            border-radius: 3px;
        }

        .link {
            text-align: right;
        }

        .link > a {
            text-decoration: none;
            text-align: right;
            color: black;
            font-size: 14px;
        }

        /*Sign In按钮*/
        .button {
            width: 100%;
            padding: 0;
            margin: 0 auto;
            height: 40px;
            text-align: center;
            line-height: 40px;
        }

        /*右侧部分样式开始*/
        #rightPart > div {
            text-align: left;
            padding: 50px 0;
            width: 400px;
        }

        #rightPart p {
            text-align: center;
            font-size: 14px;
        }

        #redundantSpaceForRightSide {
            height: 292px;
            margin: 0 !important;
            padding: 0 !important;
        }

        .redundantSpaceForBothSide {
            height: 1000px;
            margin: 0 !important;
            padding: 0 !important;
        }

    </style>
</head>
<body>
<div id="app">
    <!--最上方白条开始-->
    <div id="head"></div>
    <!--最上方白条结束-->

    <!--下方正文部分开始-->
    <div id="middle">
        <!--左侧输入框部分开始-->
        <div id="leftPart">
            <div>
                <div>
                    <p class="title">Sign In</p>
                    <div class="content">
                        <div class="item">
                            <p class="text">Username</p>
                            <el-input v-model="user.username" placeholder="Input Your Username"
                                      class="input"></el-input>
                        </div>
                        <div class="item">
                            <p class="text">Password</p>
                            <el-input v-model="user.password" placeholder="Input Your Password" show-password
                                      class="input"></el-input>
                            <p class="link"><a href="">Forgot Your <u>Password?</u></a></p>
                        </div>
                        <el-button type="danger" class="button" @Click="login()">Sign In</el-button>
                        <p class="link"><a href="/user/reg.html">New Customer?<u>Start here.</u></a></p>
                    </div>
                </div>
            </div>
            <div class="redundantSpaceForBothSide"></div>
        </div>
        <!--左侧输入框部分结束-->

        <!--右侧Use Your Account from部分开始-->
        <div id="rightPart">
            <div>
                <div class="item">
                    <p class="text">Use Your Account from</p>
                </div>
            </div>
            <div id="redundantSpaceForRightSide"></div>
            <div class="redundantSpaceForBothSide"></div>
        </div>
        <!--右侧Use Your Account from部分结束-->
    </div>
    <!--下方正文部分结束-->
</div>
</body>
<script src="../js/vue.min.js"></script>
<!-- import JavaScript -->
<script src="../js/eui.js"></script>
<script src="../js/axios.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function () {
            return {
                user: {
                    username: "",
                    password: "",
                },
            }
        },
        methods: {
            login() {
                axios.post("/user/login", v.user).then(function (response) {
                    if (response.data.state !== 200) {
                        alert("登录失败," + response.data.message);
                    } else {
                        alert("登录成功,即将跳转商城页面...");
                        location.href = "/product_details.html";
                    }
                })
            }
        }
    })
</script>
</html>